///
/// @ProjectName:    learning_rust
/// @Description:    
/// @File:           jz2.rs
/// @Author:         wujehy
/// @Email:          wujehy@qq.com
/// @Time:           2021-06-30 21:53
///

struct Solution{

}

impl Solution {
    fn new() -> Self{
        Solution{}
    }
    #[allow(non_snake_case)]
    pub fn replaceSpace(&self  , input :  &str) -> String {
        // input.replace(' ' , "%20");
        // input
        let mut  output:  String = String::new();
        for item in input.chars() {
            if item == ' ' {
                output.push_str("%20");
            }else {
                output.push(item);
            }
        }
        output
    }

}


#[test]
fn test2(){
    let s = Solution::new();
    let input = "We Are Happy";
    let expext = "We%20Are%20Happy";
    assert_eq!(expext , s.replaceSpace(input));
}